package com.swu.pad.comment.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.swu.pad.comment.dao.CommentDao;
import com.swu.pad.comment.entity.Comment;
import com.swu.pad.comment.service.CommentService;

@Service
@Transactional
public class CommentServiceImpl implements CommentService {

	@Autowired
	private CommentDao commentDao;

	public List<Comment> getComment(String assignmentPadId) {
		return commentDao.findByAssignmentPadId(assignmentPadId);
	}

	public Comment saveOrUpateComment(Comment comment) {
		return commentDao.saveAndFlush(comment);
	}

	public void deleteComment(String commentId) {
		commentDao.delete(commentId);
	}

}
